<?php 
    // dd($omodel);
    // //检测老师是否打卡

    $t = $omodel->find()->where(['t_id'=>$teacher['id'],'identity'=>1])->asArray()->all();
    // dd($t);
    $tag = 1;//表示未签到
    if(!empty($t)) {
    $date = date('Y-m-d',time());
        foreach($t as $val) {
            if(substr($val['push_time'],0,10) == $date) {
                $tag = 0;//表示已签到
            }
        }
    }
 ?>

    <div class="container mt30">
        <div class="t-title">
        <?php echo $class['name']; ?>
        </div>
        
        <div class="mine-box">
            <div class="img"><img src="../static/img/author-m.png" alt=""></div>
            <div>
                <h3>
                    <?php
                        echo $teacher['name'];
                    ?>
                </h3>
                <p style="font-size: 14px;">
                <?php echo $fenlei['name']; ?> . 舞蹈老师
                </p>
                
                <?php 
                    if($tag == 1) {
                        echo '<div class="sign">
                                <a class="a" href="punch?identity=1&cid='.$c_id.'&name='.$teacher["name"].'&person='.$teacher["name"].'&tid='.$teacher["id"].'" class="btn btn-primary">签到</a>
                              </div>';

                    }else {
                        echo '<div class="signed"><a href="javascript:" class="btn">已签到</a></div>';

                    }
                 ?>
                <!--<div class="signed">已签到</div>-->
            </div>
        </div>
        <div class="students">
            <?php 
            // dd($student);
                
                foreach ($student as $value) {
                    $tag1 = 1;
                    if(!empty($value)) {
                        //检测学生是否已经打卡
                        $t1 = $omodel->find()->where(['s_id'=>$value['s_id'],'identity'=>0])->asArray()->all();
                        // dd($t1);
                        if(!empty($t1)) {
                            $date = date('Y-m-d',time());
                            foreach($t1 as $val) {
                                if(substr($val['push_time'],0,10) == $date) {
                                    $tag1 = 0;
                                }
                            }
                        }
            ?>
            <div class="student">
                <span><?php echo $value['name'] ?></span>
                  <?php 
                            if($tag1 == 1) {

                                echo ' <span class="sign-s"><a class="a" href="punch?identity=0&sid='.$value['s_id'].'&cid='.$c_id.'&name='.$value['name'].'&person='.$teacher['name'].'&tid='.$teacher['id'].'" class="btn btn-primary">签到</a></span>';

                            }else {
                                echo '<a href="javascript:">已签到</a>';

                            }
                         ?>
           </div>
                
            <?php
                }
                    }
           ?>

        </div>

    </div>

    <script src="../static/vendor/jquery-3.1.1.min.js"></script>
    <script>
        $(function () {
            $('.bread-menu-btn').on('click', function () {
                $(this).toggleClass('active');
                $('.top-menu').toggleClass('active');
                $('.bread-menu-panel').toggleClass('active');
            });

            $('.agree').on('click', function () {
                $(this).children('.check-icon').toggleClass('active')
            });

            $('.finish-btn').on('click', function() {
              $('.form-modal').fadeIn();
            });
            $('.btn-close').on('click', function() {
              $('.form-modal').fadeOut();
            })

        })
    </script>
